﻿using System;
using System.Data;

namespace MakeItWeb.Framework
{
    [Serializable]
    public abstract class BusinessObject
    {
        protected bool m_bDirty = false;
        protected bool m_bLoaded = false;

        public abstract void Load(DataRow dr);
        public abstract void Save();

        #region Public accessor

        public bool Loaded
        {
            get { return m_bLoaded; }
        }
        public bool Dirty
        {
            get { return m_bDirty; }
        }

        #endregion

        public virtual void SetLoaded()
        {
            m_bDirty = false;
            m_bLoaded = true;
        }

        public virtual void SetDirty()
        {
            m_bDirty = true;
        }

        public virtual void SetDirty(bool bDirty)
        {
            m_bDirty = bDirty;
        }
    }
}